<!--安排工廠-->
 <script type="text/javascript">
        function goodsReceivedateAdd(id){
        	
        	$("#proofingPatternId").val(id);
        	 $.ajax({  
                 type : "POST",  //提交方式  
                 url : "../encasement/findEncasementList?productionPatternId="+id,//路径  
                 data : {  
                     
                 },//数据，这里使用的是Json格式进行传输  
                 success : function(result) {//返回数据根据结果进行相应的处理  
                	 var len = $("#tab_encasement_add").find("tr").length;
                 for(var i =1;i<=len;i++){
                	 $("#tab_encasement_arrive tr:eq("+i+")").remove();
                 }
                     for(var i=0;i<result.body.length;i++){
                    	 $("#tab_encasement_arrive tr:eq("+i+")").after('<tr>'+
                    	            '<td>'+result.body[i].batchNo+'</td>'+
                    	            '<td>'+result.body[i].deliveryDate+'</td>'+
                    	            '<td>'+result.body[i].deliver+'</td>'+
                    	            '<td  style="width:190px"><input type="hidden" name="id" value="'+result.body[i].id+'"><div class="input-group date form_datetime">'+
                    	            '<input class="form-control" size="150" type="text" name="arriveDate" value="">'+
                    	            '<span class="input-group-addon"><span	class="glyphicon glyphicon-th"></span></span></div></td></tr>');
                     }
                     $('.form_datetime').datetimepicker({
                    	format: 'yyyy-mm-dd hh:00',
     			       	language:  'zh-CN',  
     		            weekStart: 1,  
     		            todayBtn:  1,  
     		            autoclose: 1,  
     		            todayHighlight: 1,  
     		            startView: 2,  
     		            forceParse: 0,  
     		            showMeridian: 0,
     		          	minView: 1,
     		            startDate: new Date()
     			    });
                 }  
             });  
        	$('#goods_arrivedate_add').modal({
    			keyboard: true
    		});
        }
        function saveArriveDate(){
        	$("#goods_arrivedate_add_form").ajaxSubmit({  
	            type : "POST",  
	            url: "../encasement/saveArriveDate",   
	            dataType : "json",  
	            data : {productionPatternId:$("#proofingPatternId").val()},  
	            contentType : 'application/x-www-form-urlencoded; charset=UTF-8',  
	            success : function(map) {  
	            	 if(map.head.respCode=="0000000"){
		                	alert("保存成功");
		                	window.location.href="list";
		                }else{
		                	alert(map.body);
		                }
	            },  
	            error : function(map) {  
	                alert("出现错误，请刷新页面");  
	            }  
	  
	        }) 
        }
        </script>
            <div class="modal fade" id="goods_arrivedate_add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								&times;
							</button>
							<h4 class="modal-title" id="myModalLabel">
								输入到货日期
							</h4>
						</div>
						<div class="modal-body">
							<form class="form-horizontal" id="goods_arrivedate_add_form" role="form">
					<table class="table table-bordered" id="tab_encasement_arrive" style="width:500px">
                                       				<tbody><tr>
                                       					<th>物流单号</th>
                                       					<th>发货日期</th>
                                       					<th>物流公司</th>
                                       					
                                       					<th>到货日期</th>
                                       				</tr>
                                       			
                                       				
                                       				
                                       			</tbody></table>
						</form>
			            	
						</div>
						<div class="modal-footer">
							<button type="button" onclick="saveArriveDate()" class="btn btn-primary">确定
							</button>
							<button type="button" class="btn btn-default" data-dismiss="modal">
								取消
							</button>
						</div>
					</div><!-- /.modal-content -->
				</div><!-- /.modal -->
			</div>